<?php

/**
 * @Author: tianwangchong
 * @Date:   2018-06-04 16:46:42
 * @Last Modified by:   tianwangchong
 * @Last Modified time: 2018-06-04 18:33:37
 */

$path = storage_path('tmp');
return [
    'path'      => $path,
    /*
     * swoole 配置项（执行主动发消息命令必须要开启，且必须安装 swoole 插件）
     */
    'swoole'    => [
        'status' => true,
        'ip'     => '127.0.0.1',
        'port'   => '8866',
    ],
    /*
     * 下载配置项
     */
    'download'  => [
        'image'         => true,
        'voice'         => true,
        'video'         => true,
        'emoticon'      => true,
        'file'          => true,
        'emoticon_path' => $path . 'emoticons', // 表情库路径（PS：表情库为过滤后不重复的表情文件夹）
    ],
    /*
     * 输出配置项
     */
    'console'   => [
        'output'  => true, // 是否输出
        'message' => true, // 是否输出接收消息 （若上面为 false 此处无效）
    ],
    /*
     * 日志配置项
     */
    'log'       => [
        'level'      => 'debug',
        'permission' => 0777,
        'system'     => $path . 'log', // 系统报错日志
        'message'    => $path . 'log', // 消息日志
    ],
    /**
     * 数据库配置
     */
    'database'  => [
        'redis' => [
            'default' => [
                'host' => 'localhost',
                'port' => 6379,
                'database' => 1
            ]
        ]
    ],
    /*
     * 缓存配置项
     */
    'cache'     => [
        'default' => 'redis', // 缓存设置 （支持 redis 或 file）
        'stores'  => [
            'file'  => [
                'driver' => 'file',
                'path'   => $path . 'cache',
            ],
            'redis' => [
                'driver'     => 'redis',
                'connection' => 'default',
            ],
        ],
    ],
    /*
     * 拓展配置
     * ==============================
     * 如果加载拓展则必须加载此配置项
     */
    'extension' => [
        // 管理员配置（必选），优先加载 remark(备注名)
        'admin' => [
            'remark'   => '',
            'nickname' => '所有的伟大 源于一个勇敢的开始',
        ],
        // 'other extension' => [ ... ],
        'blacklist' => [
            'type' => [
                'text', 'emoticon'
            ],
            'warn' => function ($message) {
                $nickname = $message['fromType'] == 'Group' ? $message['sender']['NickName'] : $message['from']['NickName'];
                \Hanson\Vbot\Message\Text::send($message['from']['UserName'], "@{$nickname} 警告！你的消息频率略高！");
            },
            'block' => function ($message) {
                $nickname = $message['fromType'] == 'Group' ? $message['sender']['NickName'] : $message['from']['NickName'];
                \Hanson\Vbot\Message\Text::send($message['from']['UserName'], "@{$nickname} 你已被永久拉黑！");
            },
        ]
    ],
];
